package com.java.exer_3;

import java.util.Objects;

/**
 * @author shkstart
 * @create 2021-01-12 14:45
 */
public class Poker {
    //花色 0-4；
    private int type;
    //点数0-13
    private int point;


    public Poker(int type, int point) {
        this.type = type;
        this.point = point;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    @Override
    public String toString() {
        String[] type = {"♠", "♥", "♣", "♦"};
        String[] point = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
        return type[this.type] + point[this.point - 1];
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Poker)) return false;
        Poker poker = (Poker) o;
        return getType() == poker.getType() && getPoint() == poker.getPoint();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getType(), getPoint());
    }

}
